import { Component } from '@angular/core';
import { IonicPage,NavController } from 'ionic-angular';
import {HttpService} from "../../providers/HttpService";
import {NativeServiceC} from "../../providers/NativeServiceC";


@IonicPage()
@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  bookList = [];
  private bookrack:string ='/book/recommend';
  constructor(public navCtrl: NavController,
              private http:HttpService,
              private nativeService:NativeServiceC
  ) {}

  ionViewDidLoad(){
    this.getBookrack();
  }

//获取书架的书。
 private getBookrack (){
    this.http.get(this.bookrack).subscribe(res=>{
        this.bookList = res.books;
       this.nativeService.hideLoading();
    });
  }

  skipBookDetail(id){
   this.navCtrl.push('BookDetailPage',{id:id})
  }

}
